<div id="main" class="wysiwyg" data-post-id="<%= @post.slug || @post.id %>" data-preview="<%= params[:preview] %>">
  <div class="scroll-panel">
    <div class="scroll-panel-header">
      <div class="pull-left">
        <%= link_to "#", class: "btn btn-default btn-icon", data: { toggle: "off-canvas",  target: "#dashboard-nav" } do %>
          <i class="icon-st-icons-st-logo"></i>
        <% end %>
        <% if @post.is_a?(Storytime::Page) || @post.is_a?(Storytime::Blog) %>
          <%= link_to [:dashboard, current_post_type], class: "btn btn-default btn-scroll-panel-header" do %>
            <%= icon('angle-left') %>
            <span class="hidden-xs"><%= current_post_type.type_name.pluralize.titleize %></span>
          <% end %>
        <% else %>
          <%= link_to [:dashboard, @post.blog, :blog_page_post_index], class: "btn btn-default btn-scroll-panel-header" do %>
            <%= icon('angle-left') %>
            <span class="hidden-xs"><%= @post.blog.title %></span>
          <% end %>
        <% end %>
      </div>
      <div class="pull-right">
        <%= link_to "#", class: "btn btn-default btn-icon margin-right", data: { toggle: "codemirror" } do %>
          <i class="fa fa-code" style="top: -1px;"></i>
        <% end %>
        
        <% if Storytime.enable_file_upload && !@post.is_a?(Storytime::Page) && !@post.is_a?(Storytime::Blog)  %>
          <%= link_to '#', class: "btn btn-default btn-icon margin-right", data: { toggle: "collapse", target: '#featured-images-panel' } do %>
            <i class="icon-st-icons-images"></i>
          <% end %>
        <% end %>

        <div class="btn-group margin-right">
          <button type="button" class="btn btn-default btn-icon dropdown-toggle" id="post-utilities" data-toggle="dropdown" aria-expanded="false">
            <i class="icon-st-icons-utilitymenu"></i>
          </button>
          <ul class="dropdown-menu dropdown-menu-right" role="menu" style="top: 125%;">
            <li>
              <%= link_to '#', data: { toggle: 'collapse', target: '#versions-panel' } do %>
                <i class="icon-st-icons-versions"></i>
                History
              <% end %>
            </li>
            <li>
              <%= link_to url_for([:dashboard, @post]),  method: :delete, data: { confirm: t('common.are_you_sure_you_want_to_delete', resource_name: @post.human_name) } do %>
                <i class="icon-st-icons-delete"></i>
                Delete
              <% end %>
            </li>
          </ul>
        </div>

        <%= link_to "Preview", post_path(@post, preview: true), class: "btn btn-sm btn-primary btn-outline margin-right margin-left", id: "preview_post", target: "_blank" %>

        <%= link_to (@post.published? ? "Update" : "Save / Publish"), "#", class: 'btn btn-primary btn-sm btn-outline', data: { toggle: 'collapse', target: '#post-advanced-settings' }, id: "advanced-settings-panel-toggle" %>
      </div>
    </div>
    <%= render 'storytime/dashboard/posts/image_toolbar' %>
    <div class="scroll-panel-body" style="top: 130px;">
      <%= render 'form' %>
    </div>
  </div>
</div>